home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Apps / Utilities / Unix / CommandMon / UNIXobject.m < prev   
Text File  |  1992-12-26  |  562b  |  35 lines

  1.  
  2. #import "UNIXobject.h"
  3. #import <streams/streams.h>
  4. #import <dpsclient/dpsclient.h>
  5. #import <stdio.h>
  6.  
  7. @implementation UNIXobject
  8.  
  9. - execute:(char *)theCommand
  10. {
  11.     NXStream *theStream;
  12.     FILE *fp;
  13.     fp=popen(theCommand,"r");
  14.     theStream=NXOpenFile(fileno(fp),NX_READONLY);
  15.     if (delegate && [delegate respondsTo:@selector(returnOutput:)])
  16.         [delegate perform:@selector(returnOutput:)
  17.             with:(void *)theStream];
  18.     NXClose(theStream);
  19.     pclose(fp);
  20.     return self;
  21. }
  22.  
  23. - setDelegate:anObject
  24. {
  25.     delegate=anObject;
  26.     return self;
  27. }
  28.  
  29. - delegate
  30. {
  31.     return delegate;
  32. }
  33.  
  34. @end
  35.